import { lazy } from "react";

export let mainRouter: any = [
  {
    path: "/index/home",
    element: lazy(() => import("../pages/index/Home")),
    title: "首页",
  },
  {
    path: "/index/class",
    element: lazy(() => import("../pages/index/Class")),
    title: "列表",
  },
  {
    path: "/index/cart",
    element: lazy(() => import("../pages/index/Cart")),
    title: "购物车",
  },
  {
    path: "/index/my",
    element: lazy(() => import("../pages/index/My")),
    title: "我的",
  },
];

const routes: any = [
  {
    path: "/",
    to: "/index/home",
  },
  {
    path: "/index",
    element: lazy(() => import("../pages/Index")),
    children: mainRouter,
  },
  {
    path: "/login",
    element: lazy(() => import("../pages/Login")),
  },
  {
    path: "/register",
    element: lazy(() => import("../pages/Register")),
  },
  {
    path: "/details/:id",  
    element: lazy(() => import("../pages/Details")),
  },
  {
    path: "/xqyes/:id",  
    element: lazy(() => import("../pages/XqYes")),
  },
  {
    path: "/xqno/:id",  
    element: lazy(() => import("../pages/XqNo")),
  },
  {
    path: "/passenger",  
    element: lazy(() => import("../pages/Passenger")),
  },
];

export default routes;
